package com.by.facade.enums.information.sub;

import com.by.facade.enums.information.PromotionPlatformEventTypeEnum;
import com.by.facade.enums.information.PromotionPlatformTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Collections;
import java.util.Map;

/**
 * @author Tian Wei
 * @version 1.0
 * @date 2024/3/1 11:43 AM
 */
@Getter
@AllArgsConstructor
public enum GuangDianTongPromotionPlatformEventEnum{

    FORM("CONFIRM_EFFECTIVE_LEADS",1, "表单", PromotionPlatformEventTypeEnum.FORM.getType()),
    WX_CP_FRIEND_OPERATION("ADD_WECHAT", 2, "完成加V", PromotionPlatformEventTypeEnum.WX_CP_FRIEND_OPERATION.getType()),
    ;
    private final String actionType;

    private final Integer type;

    private final String desc;

    private final Integer promotionPlatformEventType;

    public static final String PROMOTION_CHANNEL_NO = "channelNo";

    public static final String CLICK_ID_PARAM_NAME = "clickId";

    public static final String OK = "OK";

    private static final String BASE_URL = "https://api.e.qq.com/v1.3/user_actions/add";

    public static GuangDianTongPromotionPlatformEventEnum resolveByPromotionPlatformEventType(Integer promotionPlatformEventType) {
        return (GuangDianTongPromotionPlatformEventEnum) PromotionPlatformTypeEnum.PROMOTION_PLATFORM_EVENT_TYPE_MAP.getOrDefault(PromotionPlatformTypeEnum.GUANG_DIAN_TONG.getType(), Collections.emptyMap()).get(promotionPlatformEventType);
    }

    public static String getBasePushUrl() {
        return BASE_URL;
    }

    public static Boolean checkResult(Map<String,Object> resultMap){
       return resultMap.values().contains(OK);
    }

}
